#!/bin/bash

go get
go build
mv prometheus PrometheusConfigUpdaterAPI
#build the linux version (amd64) of prometheus for fogflow

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build  -a -installsuffix cgo  -o PrometheusConfigUpdaterAPI
sleep 60
docker build -t "fogflow/prometheus" .
sleep 60
#docker build -t .
cid=$(docker run -d -p 4545:4545 -p 9090:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus)

echo $cid
docker cp tgroups/ $cid:/etc/prometheus/
docker exec -u 0 -d $cid chmod 777 /etc/prometheus/tgroups
docker exec -u 0 -d $cid chmod 777 /etc/prometheus/tgroups/*
